Optimal. Leaf size=161 \[ (a (A c-c C-B d)-b (B c+(A-C) d)) x-\frac {(A b c+a B c-b c C+a A d-b B d-a C d) \log (\cos (e+f x))}{f}+\frac {(A b+a B-b C) d \tan (e+f x)}{f}-\frac {(b c C-3 b B d-3 a C d) (c+d \tan (e+f x))^2}{6 d^2 f}+\frac {b C \tan (e+f x) (c+d \tan (e+f x))^2}{3 d f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.17, antiderivative size = 161, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 41, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.098, Rules used = {3718, 3711,
3606, 3556} \begin {gather*} -\frac {\log (\cos (e+f x)) (a A d+a B c-a C d+A b c-b B d-b c C)}{f}-x (-a (A c-B d-c C)+b d (A-C)+b B c)+\frac {d \tan (e+f x) (a B+A b-b C)}{f}-\frac {(-3 a C d-3 b B d+b c C) (c+d \tan (e+f x))^2}{6 d^2 f}+\frac {b C \tan (e+f x) (c+d \tan (e+f x))^2}{3 d f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3606
Rule 3711
Rule 3718
Rubi steps
\begin {align*} \int (a+b \tan (e+f x)) (c+d \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx &=\frac {b C \tan (e+f x) (c+d \tan (e+f x))^2}{3 d f}-\frac {\int (c+d \tan (e+f x)) \left (b c C-3 a A d-3 (A b+a B-b C) d \tan (e+f x)+(b c C-3 b B d-3 a C d) \tan ^2(e+f x)\right ) \, dx}{3 d}\\ &=-\frac {(b c C-3 b B d-3 a C d) (c+d \tan (e+f x))^2}{6 d^2 f}+\frac {b C \tan (e+f x) (c+d \tan (e+f x))^2}{3 d f}-\frac {\int (c+d \tan (e+f x)) (3 (b B-a (A-C)) d-3 (A b+a B-b C) d \tan (e+f x)) \, dx}{3 d}\\ &=-(b B c+b (A-C) d-a (A c-c C-B d)) x+\frac {(A b+a B-b C) d \tan (e+f x)}{f}-\frac {(b c C-3 b B d-3 a C d) (c+d \tan (e+f x))^2}{6 d^2 f}+\frac {b C \tan (e+f x) (c+d \tan (e+f x))^2}{3 d f}-(-a B c+b c C+b B d+a C d-A (b c+a d)) \int \tan (e+f x) \, dx\\ &=-(b B c+b (A-C) d-a (A c-c C-B d)) x-\frac {(a B c-b c C-b B d-a C d+A (b c+a d)) \log (\cos (e+f x))}{f}+\frac {(A b+a B-b C) d \tan (e+f x)}{f}-\frac {(b c C-3 b B d-3 a C d) (c+d \tan (e+f x))^2}{6 d^2 f}+\frac {b C \tan (e+f x) (c+d \tan (e+f x))^2}{3 d f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 1.07, size = 161, normalized size = 1.00 \begin {gather*} \frac {3 (a+i b) (A+i B-C) (-i c+d) \log (i-\tan (e+f x))+3 (a-i b) (A-i B-C) (i c+d) \log (i+\tan (e+f x))+6 (A b+a B-b C) d \tan (e+f x)+\frac {(-b c C+3 b B d+3 a C d) (c+d \tan (e+f x))^2}{d^2}+\frac {2 b C \tan (e+f x) (c+d \tan (e+f x))^2}{d}}{6 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.12, size = 187, normalized size = 1.16
method | result | size |
norman | \(\left (A a c -A b d -B a d -B b c -C a c +C b d \right ) x +\frac {\left (A b d +B a d +B b c +C a c -C b d \right ) \tan \left (f x +e \right )}{f}+\frac {\left (B b d +a C d +C b c \right ) \left (\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {C b d \left (\tan ^{3}\left (f x +e \right )\right )}{3 f}+\frac {\left (A a d +A b c +B a c -B b d -a C d -C b c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f}\) | \(151\) |
derivativedivides | \(\frac {\frac {C b d \left (\tan ^{3}\left (f x +e \right )\right )}{3}+\frac {B \left (\tan ^{2}\left (f x +e \right )\right ) b d}{2}+\frac {C \left (\tan ^{2}\left (f x +e \right )\right ) a d}{2}+\frac {C \left (\tan ^{2}\left (f x +e \right )\right ) b c}{2}+A \tan \left (f x +e \right ) b d +B \tan \left (f x +e \right ) a d +B \tan \left (f x +e \right ) b c +C \tan \left (f x +e \right ) a c -C b d \tan \left (f x +e \right )+\frac {\left (A a d +A b c +B a c -B b d -a C d -C b c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (A a c -A b d -B a d -B b c -C a c +C b d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) | \(187\) |
default | \(\frac {\frac {C b d \left (\tan ^{3}\left (f x +e \right )\right )}{3}+\frac {B \left (\tan ^{2}\left (f x +e \right )\right ) b d}{2}+\frac {C \left (\tan ^{2}\left (f x +e \right )\right ) a d}{2}+\frac {C \left (\tan ^{2}\left (f x +e \right )\right ) b c}{2}+A \tan \left (f x +e \right ) b d +B \tan \left (f x +e \right ) a d +B \tan \left (f x +e \right ) b c +C \tan \left (f x +e \right ) a c -C b d \tan \left (f x +e \right )+\frac {\left (A a d +A b c +B a c -B b d -a C d -C b c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (A a c -A b d -B a d -B b c -C a c +C b d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) | \(187\) |
risch | \(\frac {2 i B a c e}{f}-\frac {2 i B b d e}{f}-\frac {2 i C a d e}{f}-\frac {2 i C b c e}{f}+\frac {2 i A a d e}{f}+\frac {2 i A b c e}{f}-i C b c x -\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) A b c}{f}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) B a c}{f}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) B b d}{f}+i B a c x +A a c x -\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) A a d}{f}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a C d}{f}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) C b c}{f}-i B b d x +i A a d x -i C a d x +i A b c x -A b d x -B a d x -B b c x -C a c x +C b d x +\frac {2 i \left (-3 i B b d \,{\mathrm e}^{4 i \left (f x +e \right )}-3 i C b c \,{\mathrm e}^{4 i \left (f x +e \right )}-3 i C a d \,{\mathrm e}^{2 i \left (f x +e \right )}+3 A b d \,{\mathrm e}^{4 i \left (f x +e \right )}+3 B a d \,{\mathrm e}^{4 i \left (f x +e \right )}+3 B b c \,{\mathrm e}^{4 i \left (f x +e \right )}+3 C a c \,{\mathrm e}^{4 i \left (f x +e \right )}-6 C b d \,{\mathrm e}^{4 i \left (f x +e \right )}-3 i B b d \,{\mathrm e}^{2 i \left (f x +e \right )}-3 i C a d \,{\mathrm e}^{4 i \left (f x +e \right )}-3 i C b c \,{\mathrm e}^{2 i \left (f x +e \right )}+6 A b d \,{\mathrm e}^{2 i \left (f x +e \right )}+6 B a d \,{\mathrm e}^{2 i \left (f x +e \right )}+6 B b c \,{\mathrm e}^{2 i \left (f x +e \right )}+6 C a c \,{\mathrm e}^{2 i \left (f x +e \right )}-6 C b d \,{\mathrm e}^{2 i \left (f x +e \right )}+3 A b d +3 B a d +3 B b c +3 C a c -4 C b d \right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}\) | \(530\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.51, size = 156, normalized size = 0.97 \begin {gather*} \frac {2 \, C b d \tan \left (f x + e\right )^{3} + 3 \, {\left (C b c + {\left (C a + B b\right )} d\right )} \tan \left (f x + e\right )^{2} + 6 \, {\left ({\left ({\left (A - C\right )} a - B b\right )} c - {\left (B a + {\left (A - C\right )} b\right )} d\right )} {\left (f x + e\right )} + 3 \, {\left ({\left (B a + {\left (A - C\right )} b\right )} c + {\left ({\left (A - C\right )} a - B b\right )} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 6 \, {\left ({\left (C a + B b\right )} c + {\left (B a + {\left (A - C\right )} b\right )} d\right )} \tan \left (f x + e\right )}{6 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 2.70, size = 154, normalized size = 0.96 \begin {gather*} \frac {2 \, C b d \tan \left (f x + e\right )^{3} + 6 \, {\left ({\left ({\left (A - C\right )} a - B b\right )} c - {\left (B a + {\left (A - C\right )} b\right )} d\right )} f x + 3 \, {\left (C b c + {\left (C a + B b\right )} d\right )} \tan \left (f x + e\right )^{2} - 3 \, {\left ({\left (B a + {\left (A - C\right )} b\right )} c + {\left ({\left (A - C\right )} a - B b\right )} d\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 6 \, {\left ({\left (C a + B b\right )} c + {\left (B a + {\left (A - C\right )} b\right )} d\right )} \tan \left (f x + e\right )}{6 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 326 vs.
\(2 (148) = 296\).
time = 0.14, size = 326, normalized size = 2.02 \begin {gather*} \begin {cases} A a c x + \frac {A a d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {A b c \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - A b d x + \frac {A b d \tan {\left (e + f x \right )}}{f} + \frac {B a c \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - B a d x + \frac {B a d \tan {\left (e + f x \right )}}{f} - B b c x + \frac {B b c \tan {\left (e + f x \right )}}{f} - \frac {B b d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {B b d \tan ^{2}{\left (e + f x \right )}}{2 f} - C a c x + \frac {C a c \tan {\left (e + f x \right )}}{f} - \frac {C a d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {C a d \tan ^{2}{\left (e + f x \right )}}{2 f} - \frac {C b c \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {C b c \tan ^{2}{\left (e + f x \right )}}{2 f} + C b d x + \frac {C b d \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac {C b d \tan {\left (e + f x \right )}}{f} & \text {for}\: f \neq 0 \\x \left (a + b \tan {\left (e \right )}\right ) \left (c + d \tan {\left (e \right )}\right ) \left (A + B \tan {\left (e \right )} + C \tan ^{2}{\left (e \right )}\right ) & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 2918 vs.
\(2 (162) = 324\).
time = 1.70, size = 2918, normalized size = 18.12 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 8.84, size = 153, normalized size = 0.95 \begin {gather*} \frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (\frac {A\,a\,d}{2}+\frac {A\,b\,c}{2}+\frac {B\,a\,c}{2}-\frac {B\,b\,d}{2}-\frac {C\,a\,d}{2}-\frac {C\,b\,c}{2}\right )}{f}-x\,\left (A\,b\,d-A\,a\,c+B\,a\,d+B\,b\,c+C\,a\,c-C\,b\,d\right )+\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {B\,b\,d}{2}+\frac {C\,a\,d}{2}+\frac {C\,b\,c}{2}\right )}{f}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (A\,b\,d+B\,a\,d+B\,b\,c+C\,a\,c-C\,b\,d\right )}{f}+\frac {C\,b\,d\,{\mathrm {tan}\left (e+f\,x\right )}^3}{3\,f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________